import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

  const routes = [
  {
    path: '/',
    component: Home,
    children: [
      {
        path: '/',
        name: 'home',
        component: () => import('../views/Index')
      },
      {
        path: 'news',
        name: 'news',
        component: () => import('../views/News')
      },
      {
        path: 'questions',
        name: 'questions',
        component: () => import('../views/Question')
      },
      {
        path: 'art-detail',
        name: 'art-detail',
        component: () => import('../views/ArticleDetail')
      },
      {
        path: 'article',
        name: 'article',
        component: () => import('../views/Article')
      },
      {
        path: 'add-record',
        name: 'add-record',
        component: () => import('../views/Record.vue')
      },
      {
        path: 'about',
        name: 'about',
        component: () => import('../views/About')
      },
      {
        path: 'search',
        name: 'search',
        component: () => import('../views/Search.vue')
      },
      {
        path: 'settings',
        component: () => import('../views/Center.vue'),
        children: [
          {
            path: '/',
            name: 'baseinfo',
            component: () => import('../views/BaseInfo.vue')
          },
          {
            path: 'edit',
            name: 'edit',
            component: () => import('../views/Edit.vue')
          }
        ]
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Login')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/register')
  }
]

const router = new VueRouter({
  routes
})

export default router
